package com.bw.utils.alipay;

import java.io.FileWriter;
import java.io.IOException;

        /* *
         *类名：AlipayConfig
         *功能：基础配置类
         *详细：设置帐户有关信息及返回路径
         *修改日期：2017-04-05
         *说明：
         *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
         *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
         */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016102600766091";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCmipJZcvA2iJ/bFpfJ6kcu+/CstVkSceMH5hNpTihrzQY+HsWv6JbyLNW9IKO/dAWRoTfN1cHMhN0GAXAQ/pjgzQH9PX26Dh9BF4x7hNmWHQn2jcTz46s5klA22p5sYPzhPzjnaKVwtfdWQ8B8opLIxko/alXosCkCrECE9/m6ZM1CPcpCBPOl3DpmUXGFpKete0hiVm/xN84tT8Oy/pumDIuJGoyy2YxWT/xRk0EAnBoy5KNvGsNm8b3DZc/n/mQrkd2NqSvGArHBHNaDavaX85mOSs8DqP9yXC/ZIFZOn/uERl9VhKk2S8ww0asoLRcmFbgjGBMeQLdFo0YZG9j5AgMBAAECggEBAJHK5Wtg72EOIcMN+DtO2JoM/Bh1eVBoWrNjesLJJSGaDkj7b1wbZWkETuiOVksYKnfehpeu9UUxWrwTLiPyfaruTTuARTxHeJznHJhVKJX9PeeVHEHVoON5brdWkzGVhks5qXsLZSlSYwAlt7BkMdOJox343NQiwwQP/ztoSjoc7qlqTDu+SGy8vnttp67RFqxGGGBw5ml1CK2i6hx4SsZ8RSTamroMQ1muyDYF95AZqIPem/bppHDf3IHExtI6DqlWyHmuKm9eSQZ9OdLXxfhsBc78KnASmAawFaYtMuiaDrexoyLpnk6Ki3peRlRIsjW3f0iL0ypgml0Gjk8EG8ECgYEA8QUo4yx+6oCcii1j2xS+3F0iNLj4SI+Yd5P4XRGQGJZjvEzWBdaMFR5LWw8vO9Q+vx/fu2LQMguxjfeZguXTLOKunOka5yKKuRm+Cgp8r8+Aw/tgxCN9hJodNxan+4meJTSYKaoRMeXibCkdmntosnpc0UWHT4SxCkcvNjXg28UCgYEAsORjds7wjeyg29NH2eNbLTlox8/zTOfzwHbFVJs+0wcPi/Wto1f/KI1XhwTAF9nz+dRJLWsGCGBaocTU2Pr0QbX9G1ZnTfLWXrCWgJSf2MzUlIVSoL9y9l4yrDKZXouew3ktMEbs4iwDzv1cf2UlUSJDj9GKJMHBxeKfog8pl6UCgYAWSU/akca6kGHpNQFCxMxRPBtpnKD4tK54gCo7EOCuJVnbk49Gwuv5F/AH34OSmLGkoqHhheWSexpT8k0zmWTJhbx3reZa8Qq6yvKToxycdSeG97ue51k35bhF28Z0r+j7r71SPPOSFZu2PKcMHdU0i7QBddhpNe/Y73QiIyFDsQKBgQCSZGDAaWCBRAyYAFGdS+AgHDvP6RQkWG3MoT6L13L1uAkwviB2ZxPenqKKNe83jgOwhPQOp1y1v/AhosC31XAhlZgjcK1LwCWS9beIL/fdtx5Sz8djCy38IFb1VWbB7PB2Oymfo4LVZrG8MsfDEpUAgUfClRorc0KHHxcXSk8UlQKBgFvQ3Wxr7QumqmHqOdweblkJ10o0io2jdWklteAtf6hAMdfi8bszGE/b4LrV4unn1sGJmcgb9H+XGWuVoMoPOjMe/FjiR6jMaZf7dAhMqL4r8pKi2HZKfPH+5Y+6zZt2QO8Sdu7dtEML4dx/Ci+iCSJ0A+gAatZer/3ZOBLBurXa";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApCBB/sy02LsTkmY8NaZ+dbJbtwNdiCAEQKa3RXtJfD60CkKxFvRne/0eznSnoSR53go7DH16QSzp/Zl5kDOZa0ThUm6HNY9oCcf81zSNXGba0QqQN6ebj0Ldwx4DanlFRrITN5jYpi4/5MwajB+GzrQJXVG8gobuuy6AxPfe+kTWQkmxG3f+nJFH2Tn5j3zJ9h/XAojAqQwVSXtI4vYzotBlSh7KDPD4h3aqsnNDE5U3c+aQ6MY+sgsYamW3A0tl5jgYNq/2Mkyb3wdTRSHmosP8Cy0rMeWRxZZ8RX2xzLaUcr+cluHVvSAX6txmLccg/mBW4ZJz7BDNy3pZjPCwewIDAQAB";
    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8888/#/alipay";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

